﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using cbelo.Models;
using cbelo.Helpers;

namespace cbelo.Controllers
{
    public class MDFController : Controller
    {
        //
        // GET: /MDF/

        mdfRepositorio mdfRepositorio = new mdfRepositorio();

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult MDF()
        {
            var id = 1;
            var page = 0;

            var alldataMDF = mdfRepositorio.Select();
            var paginateddataMDF = new NonPaginatedList<mdf>(alldataMDF);

            ViewData["MDF"] = paginateddataMDF;

            var title = mdfRepositorio.GetGroupName(id);
            ViewData["title"] = title;

            var alldata = mdfRepositorio.SelectGroup(id);
            var paginateddata = new PaginatedListPages<mdfproduct>(alldata, page, HelpersConstants.MaxPageSize);

            return View(paginateddata);
        }

        public ActionResult MDFDetails(int id, int page)
        {
            var alldataMDF = mdfRepositorio.Select();
            var paginateddataMDF = new NonPaginatedList<mdf>(alldataMDF);

            ViewData["MDF"] = paginateddataMDF;

            var title = mdfRepositorio.GetGroupName(id);
            ViewData["title"] = title;

            var alldata = mdfRepositorio.SelectGroup(id);
            var paginateddata = new PaginatedListPages<mdfproduct>(alldata, page,HelpersConstants.MaxPageSize);

            return View(paginateddata);
        }

    }
}
